<?php
/**
 * Introduction: 收货地址  member_address
 */

namespace Common\Model;


use Think\Model;

class MemberAddressModel extends Model
{
    //定义数据库连接信息
    protected $connection;

    //定义表名
    protected $tableName = 'member_address';

    /**
     * 初始化
     */
    public function _initialize()
    {

        $this->connection = C('Databaese');

    }

    /**
     * 获取单条数据
     */
    public function getOne($member_id){
        $info = $this->where("userid=$member_id and is_default=1")->find();
        if(empty($info)){
            $info = array();
        }
        return $info;
    }

    /**
     * 获取多条数据
     */
    public function getlist($member_id){
        $list = $this->where("userid=$member_id")->order("is_default desc")->select();
        if(empty($list)){
            $list = array();
        }
        return $list;
    }


}